class ProfileController < ApplicationController

  before_filter :protect
  
  def index
    # Redirect to own profile
    user = get_user
    redirect_to :action => "show", :username => user.username
  end

  def show
    @user = User.find_by_id( params[:username] )
    current_user = get_user
    if @user == current_user || current_user.is_volcom  || current_user.is_otwmember
      @title = "Volunteer Profile for #{@user.username}"
      @userskills = @user.get_all_skills
    else
      flash[:notice] = "You must be an OTW member to view other users' profiles."
      redirect_to :action => "show", :username => current_user.username
    end
  end

end
